<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
if (isset($_SESSION['nivel']) && $_SESSION['nivel'] == 0 || $_SESSION['nivel'] == 1) {
    require_once $_SERVER['DOCUMENT_ROOT'] . '/DivSoft/Basicas/database/DMysql.php';
    $dMysqli = new DMysql();
    $usuarios = $dMysqli->getAllUsers();
?>
    <table>
        <tr>
            <td height="100px">
                <div class="dados" id="dados" name="dados">
                    <table id="usuarios">
                        <th>Nome</th>
                        <th>Email</th>

                    <?php
                    for ($i = 0; $i < count($usuarios); $i++) {
                    ?>
                        <tr onclick='<?php echo "javascript: preencheDados(" . $usuarios[$i]->cpf . ");"; ?>'>
                            <td class="itemDados" >
                                <p><?php echo $usuarios[$i]->nome; ?></p>
                            </td>
                            <td>
                                <p><?php echo $usuarios[$i]->email ?></p>
                            </td>
                            <td>
                                <img src="imagens/edit.ico" alt="Editar" title="Editar" onclick="preenche()">
                            </td>
                        </tr>
                    <?php
                    }
                    ?>

                </table>
            </div>

        </td>
        <td>
            <form action="controllerCadastro.php" method="post">
                <div align="left" class="formularioGrid">
                    <div class="topo">Dados</div>
                    <div class="itemGrid">
                        <div class="esq1">Nome Completo:&nbsp;</div>
                        <div class="dir1"><input name="nome" value=""></div>
                    </div>
                    <div class="itemGrid">
                        <div class="esq2">Senha:&nbsp;</div><div class="dir2"><input name="senha" type=""></div>
                    </div>
                    <div class="itemGrid">
                        <div class="esq1">RG:&nbsp;</div><div class="dir1"><input name="rg" value=""></div>
                    </div>
                    <div class="itemGrid">
                        <div class="esq2">CPF:&nbsp;</div><div class="dir2"><input name="cpf" value=""></div>
                    </div>
                    <div class="itemGrid">
                        <div class="esq1">Curso:&nbsp;</div><div class="dir1"><input name="curso" value=""></div>
                    </div>
                    <div class="itemGrid">
                        <div class="esq2">Período:&nbsp;</div><div class="dir2"><input name="periodo" value=""></div>
                    </div>
                    <div class="itemGrid">
                        <div class="esq1">Endereço:&nbsp;</div><div class="dir1"><input name="endereco" value=""></div>
                    </div>
                    <div class="itemGrid">
                        <div class="esq2">Bairro:&nbsp;</div><div class="dir2"><input name="bairro" value=""></div>
                    </div>
                    <div class="itemGrid">
                        <div class="esq1">Cidade:&nbsp;</div><div class="dir1"><input name="cidade" value=""></div>
                    </div>
                    <div class="itemGrid">
                        <div class="esq2">CEP:&nbsp;</div><div class="dir2"><input name="cep" value=""></div>
                    </div>
                    <div class="itemGrid">
                        <div class="esq1">Telefone Residencial:&nbsp;</div><div class="dir1"><input name="telRes" value=""></div>
                    </div>
                    <div class="itemGrid">
                        <div class="esq2">Celular:&nbsp;</div><div class="dir2"><input name="celular" value=""></div>
                    </div>
                    <div class="itemGrid">
                        <div class="esq1">Email:&nbsp;</div><div class="dir1"><input name="email" value=""></div>
                    </div>
                    <input name="operacao" type="hidden" value="atualizarUsuario">
                    <div><input type="submit"></div>
                </div>
            </form>
        </td>
    </tr>
</table>
<?php
                } else {
                    header('Location:../index.php');
                }
?>